﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Bill.aspx.cs" Inherits="WebForms_Bill" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
    <section class="featured">
        <div class="content-wrapper" dir="rtl">
            قبض
        </div>
    </section>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <script type="text/javascript">
        function SelectItem(sender, e) {
            e.IsValid = (e.Value != '0');
        }
        function dropdownOnChange(obj) {
            if (window.onbeforeunload = null)
                return true;
            if (obj.value == "2") {
                document.getElementById("<%= BillFormView.FindControl("UsedValueLabel1").ClientID %>").innerHTML = "کیلو وات";
            }
            else {
                document.getElementById("<%= BillFormView.FindControl("UsedValueLabel1").ClientID %>").innerHTML = "متر مکعب";
            }

        }

    </script>

    <asp:MultiView ID="BillMultiView" runat="server">
        <asp:View ID="BillShowView" runat="server">
            <div dir="rtl" style="width: 100%;">
                <asp:ImageButton ID="NewImageButton" runat="server" OnClick="NewImageButton_Click" SkinID="DatabaseAddButton" />
                <asp:ImageButton ID="SearchImageButton" runat="server" OnClick="SearchImageButton_Click"
                    SkinID="SearchButton" />
                <asp:ImageButton ID="ClearImageButton" runat="server" OnClick="ClearImageButton_Click"
                    OnClientClick="return false;" SkinID="ClearButton" />
                <br />
                <asp:Label ID="CenterNameLabel" runat="server" Text="نام مرکز:" SkinID="Caption" CssClass="lable"></asp:Label>
                <asp:DropDownList ID="CenterNameDropDownList" SkinID="SearchDropDownList" runat="server" DataSourceID="CenterEntityDataSource" DataTextField="Name" DataValueField="ID">
                </asp:DropDownList>
                <asp:Label ID="TypeLabel" runat="server" Text="نوع قبض:" SkinID="Caption" CssClass="lable"></asp:Label>
                <asp:DropDownList ID="TypeDropDownList" runat="server" SkinID="SearchDropDownList" DataSourceID="ConstantEntityDataSource" DataTextField="ConstantName"
                    DataValueField="ConstantValue">
                </asp:DropDownList>
                <asp:Label ID="SizePageLabel" runat="server" Text="سایز صفحه:" SkinID="Caption" CssClass="lable"></asp:Label>
                <asp:DropDownList ID="PageSizeDropDownList" SkinID="SearchDropDownList" runat="server">
                    <asp:ListItem Selected="True" Value="5">[پیش فرض]</asp:ListItem>
                    <asp:ListItem Value="5">5 رکورد</asp:ListItem>
                    <asp:ListItem Value="10">10 رکورد</asp:ListItem>
                    <asp:ListItem Value="15">15 رکورد</asp:ListItem>
                    <asp:ListItem Value="20">20 رکورد</asp:ListItem>
                    <asp:ListItem Value="25">25 رکورد</asp:ListItem>
                    <asp:ListItem Value="1000000">تمام رکورد ها</asp:ListItem>
                </asp:DropDownList>
            </div>
            <br />
            <div style="float: right; width: 90%; vertical-align: top;" dir="rtl" class="gvclass">
                <asp:GridView ID="BillGridView" runat="server" AllowPaging="True" AllowSorting="True"
                    DataKeyNames="PkBillID" DataSourceID="BillEntityDataSource" HorizontalAlign="Center"
                    Width="100%" AutoGenerateColumns="False" OnSelectedIndexChanged="BillGridView_SelectedIndexChanged">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="SelectImageButton" runat="server" CommandName="Select" SkinID="SelectButton" />
                            </ItemTemplate>
                            <ItemStyle Width="25px" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="PkBillID" HeaderText="PkBillID" ReadOnly="True" SortExpression="PkBillID" Visible="False" />
                        <asp:TemplateField HeaderText="نام مرکز" HeaderStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:DropDownList ID="CenterDropDownList" runat="server"
                                    DataSourceID="CenterEntityDataSource" DataTextField="Name" DataValueField="ID"
                                    SelectedValue='<%# Eval("FkCenterID") %>' Enabled="False" SkinID="GridDropDownList">
                                </asp:DropDownList>
                            </ItemTemplate>
                            <HeaderStyle Width="100px" />
                            <ItemStyle Width="100px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="نوع قبض">
                            <ItemTemplate>
                                <asp:DropDownList ID="TypeDropDownList" Width="150px" Height="24px" runat="server"
                                    DataSourceID="ConstantEntityDataSource" DataTextField="ConstantName" DataValueField="ConstantValue"
                                    SelectedValue='<%# Eval("Type") %>' Enabled="False" SkinID="GridDropDownList">
                                </asp:DropDownList>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                            <ItemStyle Width="100px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="BillKnow" HeaderText="شناسه قبض" SortExpression="BillKnow">
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="از تاریخ">
                            <ItemTemplate>
                                <pdc:PersianDateLabel ID="StartPersianDateLabel" runat="server" DateValue='<%# Bind("StartDate") %>'></pdc:PersianDateLabel>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                            <ItemStyle Width="100px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="تا تاریخ">
                            <ItemTemplate>
                                <pdc:PersianDateLabel ID="EndPersianDateLabel" runat="server" DateValue='<%# Bind("EndDate") %>'></pdc:PersianDateLabel>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                            <ItemStyle Width="100px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="UsedValue" HeaderText="مقدار مصرف" SortExpression="UsedValue">
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Price" HeaderText="مبلغ" SortExpression="Price">
                            <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
                        </asp:BoundField>
                    </Columns>
                </asp:GridView>
            </div>
        </asp:View>
        <asp:View ID="EditView" runat="server">
            <div style="width: 100px; float: right">&nbsp;</div>
            <div style="float: right; width: 500px; vertical-align: top;" dir="rtl" class="gvclass">
                <asp:FormView ID="BillFormView" runat="server" DataSourceID="BillEntityDataSource" DataKeyNames="PkBillID" DefaultMode="Insert" Width="100%">
                    <EditItemTemplate>
                        <table border="0" style="width: 480px" dir="rtl">
                            <tr>
                                <td style="width: 150px;">
                                    <asp:Label ID="CenterNameLabel" runat="server" Text="نام مرکز:" SkinID="Caption" CssClass="lable"></asp:Label></td>
                                <td style="width: 200px;">
                                    <asp:DropDownList ID="FkCenterIDDropDownList" runat="server"
                                        DataSourceID="CenterEntityDataSource" DataTextField="Name" DataValueField="ID"
                                        SelectedValue='<%# Bind("FkCenterID") %>'>
                                    </asp:DropDownList>
                                </td>
                                <td style="width: 130px;">
                                    <asp:CustomValidator ID="CenterCustomValidator" runat="server" ClientValidationFunction="SelectItem"
                                        ControlToValidate="FkCenterIDDropDownList" Display="Dynamic" ErrorMessage="*" ValidateEmptyText="True"
                                        ValidationGroup="Update"></asp:CustomValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="TypeLabel" runat="server" Text="نوع قبض:" SkinID="Caption" CssClass="lable"></asp:Label></td>
                                <td>
                                    <asp:DropDownList ID="TypeDropDownList" runat="server" DataSourceID="ConstantEntityDataSource"
                                        DataTextField="ConstantName" DataValueField="ConstantValue" SelectedValue='<%# Bind("Type") %>' onchange="dropdownOnChange(this);">
                                    </asp:DropDownList>
                                </td>
                                <td>
                                    <asp:CustomValidator ID="TypeCustomValidator" runat="server" ClientValidationFunction="SelectItem"
                                        ControlToValidate="TypeDropDownList" Display="Dynamic" ErrorMessage="*" ValidateEmptyText="True"
                                        ValidationGroup="Update"></asp:CustomValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="BillKnowLabel1" runat="server" Text="شناسه قبض:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="BillKnowTextBox" runat="server" Text='<%# Bind("BillKnow") %>' />
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="BillKnowRequiredFieldValidator" runat="server" ControlToValidate="BillKnowTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="StarLabel" runat="server" Text="از تاریخ:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <pdc:PersianDateTextBox ID="StartPersianDateTextBox" runat="server" DateValue='<%# Bind("StartDate") %>'
                                        PickerDirection="ToRight" ShowPickerOnTop="True"></pdc:PersianDateTextBox>
                                    <pdc:PersianDateValidator ID="StartPersianDateValidator" runat="server" ControlToValidate="StartPersianDateTextBox"
                                        Display="Dynamic" ErrorMessage="تاریخ قابل پذیرش نیست" ValidationGroup="Update"></pdc:PersianDateValidator>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="StartPersianDateRequiredFieldValidator" runat="server" ControlToValidate="StartPersianDateTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>

                                <td>
                                    <asp:Label ID="EndLabel" runat="server" Text="تا تاریخ:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <pdc:PersianDateTextBox ID="EndPersianDateTextBox" runat="server" DateValue='<%# Bind("EndDate") %>'
                                        PickerDirection="ToRight" ShowPickerOnTop="True"></pdc:PersianDateTextBox>
                                </td>
                                <td>
                                    <asp:CompareValidator ID="DateCompareValidator" runat="server" ControlToValidate="StartPersianDateTextBox" ValidationGroup="Update" ControlToCompare="EndPersianDateTextBox"
                                        ErrorMessage="از تاریخ کوچکتر مساوی تا تاریخ است" Operator="LessThanEqual" Display="Dynamic"></asp:CompareValidator>
                                    <asp:RequiredFieldValidator ID="EndPersianDateRequiredFieldValidator" runat="server" ControlToValidate="EndPersianDateTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                    <pdc:PersianDateValidator ID="EndPersianDateValidator" runat="server" ControlToValidate="EndPersianDateTextBox"
                                        Display="Dynamic" ErrorMessage="تاریخ قابل پذیرش نیست" ValidationGroup="Update"></pdc:PersianDateValidator>
                                </td>
                            </tr>
                            <tr>

                                <td>
                                    <asp:Label ID="UsedValueLabel" runat="server" Text="مقدار مصرف:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="UsedValueTextBox" runat="server" Text='<%# Bind("UsedValue") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="UsedValueLabel1" runat="server" Text="" SkinID="Caption" CssClass="lable"></asp:Label>
                                    <asp:RequiredFieldValidator ID="UsedValueRequiredFieldValidator" runat="server" ControlToValidate="UsedValueTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="UsedValueRangeValidator" runat="server" ControlToValidate="UsedValueTextBox"
                                        ErrorMessage="مقدار وارد شده باید عدد باشد" Type="Double" ValidationGroup="Update" MinimumValue="0" MaximumValue="2147483647"></asp:RangeValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="PriceLabel" runat="server" Text="مبلغ:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="PriceTextBox" runat="server" Text='<%# Bind("Price") %>' />
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="PriceRequiredFieldValidator" runat="server" ControlToValidate="PriceTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="PriceRangeValidator" runat="server" ControlToValidate="PriceTextBox"
                                        ErrorMessage="مقدار وارد شده باید عدد باشد" Type="Integer" ValidationGroup="Update" MinimumValue="0" MaximumValue="2147483647"></asp:RangeValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="UsedPeriodLabel" runat="server" Text="تعداد روز دوره:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="UsedPeriodTextBox" runat="server" Text='<%# Bind("UsedPeriod") %>' />
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="UsedPeriodRequiredFieldValidator" runat="server" ControlToValidate="UsedPeriodTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="UsedPeriodRangeValidator" runat="server" ControlToValidate="UsedPeriodTextBox"
                                        ErrorMessage="مقدار وارد شده باید عدد باشد" Type="Integer" ValidationGroup="Update" MinimumValue="0" MaximumValue="2147483647"></asp:RangeValidator>
                                </td>
                            </tr>
                        </table>
                        <div style="float: left; padding: 10px;">
                            <asp:LinkButton ID="DeleteLinkButton" runat="server" CausesValidation="False" CommandName="Delete" CssClass="button"
                                OnClientClick="if (!confirm('آيا از حذف مطمئن هستيد؟')) return false;" Text="حذف" />

                            <asp:LinkButton ID="UpdateLinkButton" runat="server" CommandName="Update"
                                ValidationGroup="Update" OnClientClick="if (!confirm('آيا از اعمال تغییرات مطمئن هستيد؟')) return false;" Text="ویرایش" CssClass="button" />

                            <asp:LinkButton ID="CancelLinkButton" runat="server" CommandName="Cancel" Text="انصراف" CssClass="button" />
                        </div>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <table border="0" style="width: 480px" dir="rtl">
                            <tr>
                                <td style="width: 150px;">
                                    <asp:Label ID="CenterNameLabel" runat="server" Text="نام مرکز:" SkinID="Caption" CssClass="lable"></asp:Label></td>
                                <td style="width: 200px;">
                                    <asp:DropDownList ID="FkCenterIDDropDownList" runat="server"
                                        DataSourceID="CenterEntityDataSource" DataTextField="Name" DataValueField="ID"
                                        SelectedValue='<%# Bind("FkCenterID") %>'>
                                    </asp:DropDownList>
                                </td>
                                <td style="width: 130px;">
                                    <asp:CustomValidator ID="CenterCustomValidator" runat="server" ClientValidationFunction="SelectItem"
                                        ControlToValidate="FkCenterIDDropDownList" Display="Dynamic" ErrorMessage="*" ValidateEmptyText="True"
                                        ValidationGroup="Insert"></asp:CustomValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="TypeLabel" runat="server" Text="نوع قبض:" SkinID="Caption" CssClass="lable"></asp:Label></td>
                                <td>
                                    <asp:DropDownList ID="TypeDropDownList" runat="server" DataSourceID="ConstantEntityDataSource"
                                        DataTextField="ConstantName" DataValueField="ConstantValue" SelectedValue='<%# Bind("Type") %>' onchange="dropdownOnChange(this);">
                                    </asp:DropDownList>
                                </td>
                                <td>
                                    <asp:CustomValidator ID="TypeCustomValidator" runat="server" ClientValidationFunction="SelectItem"
                                        ControlToValidate="TypeDropDownList" Display="Dynamic" ErrorMessage="*" ValidateEmptyText="True"
                                        ValidationGroup="Insert"></asp:CustomValidator>
                                </td>
                                <tr>
                                    <td>
                                        <asp:Label ID="BillKnowLabel1" runat="server" Text="شناسه قبض:" SkinID="Caption" CssClass="lable"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="BillKnowTextBox" runat="server" Text='<%# Bind("BillKnow") %>' />
                                    </td>
                                    <td>
                                        <asp:RequiredFieldValidator ID="BillKnowRequiredFieldValidator" runat="server" ControlToValidate="BillKnowTextBox"
                                            Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="StarLabel" runat="server" Text="از تاریخ:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <pdc:PersianDateTextBox ID="StartPersianDateTextBox" runat="server" DateValue='<%# Bind("StartDate") %>'
                                        PickerDirection="ToRight" ShowPickerOnTop="True"></pdc:PersianDateTextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="StartPersianDateRequiredFieldValidator" runat="server" ControlToValidate="StartPersianDateTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    <pdc:PersianDateValidator ID="StartPersianDateValidator" runat="server" ControlToValidate="StartPersianDateTextBox"
                                        Display="Dynamic" ErrorMessage="تاریخ قابل پذیرش نیست" ValidationGroup="Insert"></pdc:PersianDateValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="EndLabel" runat="server" Text="تا تاریخ:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <pdc:PersianDateTextBox ID="EndPersianDateTextBox" runat="server" DateValue='<%# Bind("EndDate") %>'
                                        PickerDirection="ToRight" ShowPickerOnTop="True"></pdc:PersianDateTextBox>
                                     </td>
                                <td>
                                    <asp:CompareValidator ID="DateCompareValidator" runat="server" ControlToValidate="StartPersianDateTextBox" ValidationGroup="Insert" ControlToCompare="EndPersianDateTextBox"
                                        ErrorMessage="از تاریخ کوچکتر مساوی تا تاریخ است" Operator="LessThanEqual" Display="Dynamic"></asp:CompareValidator>
                                    <asp:RequiredFieldValidator ID="EndPersianDateRequiredFieldValidator" runat="server" ControlToValidate="EndPersianDateTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    <pdc:PersianDateValidator ID="EndPersianDateValidator" runat="server" ControlToValidate="EndPersianDateTextBox"
                                        Display="Dynamic" ErrorMessage="تاریخ قابل پذیرش نیست" ValidationGroup="Insert"></pdc:PersianDateValidator>
                                </td>
                            </tr>
                            <tr>

                                <td>
                                    <asp:Label ID="UsedValueLabel" runat="server" Text="مقدار مصرف:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="UsedValueTextBox" runat="server" Text='<%# Bind("UsedValue") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="UsedValueLabel1" runat="server" Text="" SkinID="Caption" CssClass="lable"></asp:Label>
                                    <asp:RequiredFieldValidator ID="UsedValueRequiredFieldValidator" runat="server" ControlToValidate="UsedValueTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="UsedValueRangeValidator" runat="server" ControlToValidate="UsedValueTextBox"
                                        ErrorMessage="مقدار وارد شده باید عدد باشد" Type="Double" ValidationGroup="Insert" MinimumValue="0" MaximumValue="2147483647"></asp:RangeValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="PriceLabel" runat="server" Text="مبلغ:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="PriceTextBox" runat="server" Text='<%# Bind("Price") %>' />
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="PriceRequiredFieldValidator" runat="server" ControlToValidate="PriceTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="PriceRangeValidator" runat="server" ControlToValidate="PriceTextBox"
                                        ErrorMessage="مقدار وارد شده باید عدد باشد" Type="Integer" ValidationGroup="Insert" MinimumValue="0" MaximumValue="2147483647"></asp:RangeValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="UsedPeriodLabel" runat="server" Text="تعداد روز دوره:" SkinID="Caption" CssClass="lable"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="UsedPeriodTextBox" runat="server" Text='<%# Bind("UsedPeriod") %>' />
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="UsedPeriodRequiredFieldValidator" runat="server" ControlToValidate="UsedPeriodTextBox"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="UsedPeriodRangeValidator" runat="server" ControlToValidate="UsedPeriodTextBox"
                                        ErrorMessage="مقدار وارد شده باید عدد باشد" Type="Integer" ValidationGroup="Insert" MinimumValue="0" MaximumValue="2147483647"></asp:RangeValidator>
                                </td>
                            </tr>
                        </table>

                        <div style="float: left; padding: 10px;">
                            <asp:LinkButton ID="InsertLinkButton" runat="server" CommandName="Insert" Text="ایجاد" CssClass="button"
                                ValidationGroup="Insert" />
                            <asp:LinkButton ID="CancelLinkButton" runat="server" CommandName="Cancel" Text="انصراف" CssClass="button" />
                        </div>
                        </div>
                    </InsertItemTemplate>

                </asp:FormView>
            </div>
        </asp:View>
    </asp:MultiView>
    <asp:EntityDataSource ID="CenterEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities" DefaultContainerName="ICTBillingEntities"
        EnableFlattening="False"
        CommandText="(SELECT  it.[PkCenterID] As ID, it.[CenterName] As Name FROM ICTBillingEntities.tbCenters AS it) UNION (SELECT x.[ConstantValue] as ID,x.[ConstantName] As Name from ICTBillingEntities.tbConstants as x where x.PkConstantID=2)">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="BillEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities"
        DefaultContainerName="ICTBillingEntities" EnableDelete="True" EnableFlattening="False" EnableInsert="True"
        EnableUpdate="True" EntitySetName="tbBills" OnDeleted="BillEntityDataSource_Command"
        OnInserted="BillEntityDataSource_Command" OnUpdated="BillEntityDataSource_Command"
        Where="(@FkCenterID = 0 || it.FkCenterID = @FkCenterID) AND (@Type = 0 || it.Type = @Type )">
        <WhereParameters>
            <asp:ControlParameter ControlID="CenterNameDropDownList" Name="FkCenterID" PropertyName="SelectedValue" DbType="Int32" />
            <asp:ControlParameter ControlID="TypeDropDownList" Name="Type" PropertyName="SelectedValue" DbType="Int16" />
        </WhereParameters>

    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ConstantEntityDataSource" runat="server" ConnectionString="name=ICTBillingEntities" DefaultContainerName="ICTBillingEntities"
        EnableFlattening="False"
        CommandText="(SELECT x.[ConstantValue],x.[ConstantName]  from ICTBillingEntities.tbConstants as x where (x.[PkConstantID] = 2 || x.[FatherID] = 3))"
        EntityTypeFilter="" Select="">
    </asp:EntityDataSource>
    <pdc:PersianDateScriptManager ID="PersianDateScriptManager" runat="server">
    </pdc:PersianDateScriptManager>
</asp:Content>

